"use client"; /** * /w/:workspace/ask — full-page RAG workspace search (TASK-0125). * * The same `AskAiSearch` component the search page embeds as a card, in its * `page` variant. The question is shareable via `?q=` (seeded into the input * on load) and `?open=1` pre-fills it (the command palette's "Ask AI about * this workspace" entry routes here). Asking updates `?q=` so the URL stays * shareable. * * Route note (recorded conflict): the spec says `app/(workspace)/ask`, but * this app's workspace route group is `(app)` — the spec's group does not * exist here. */ import { Suspense, useCallback, useState } from "react"; import { useParams, useSearchParams, useRouter } from "next/navigation"; import { useWorkspace } from "@/hooks/use-workspace"; import { AskAiSearch } from "@/components/search/ask-ai-search"; export default function AskPage() { return (

Loading…

} >
); } function AskPageInner() { const params = useParams<{ workspace: string }>(); const workspaceSlug = params?.workspace ?? ""; const { data: workspace } = useWorkspace(workspaceSlug); const searchParams = useSearchParams(); const router = useRouter(); // Shareable question: `?q=` deep link (seeded into the input on load); // `?open=1` (the palette entry) also seeds it. const initialQuery = searchParams.get("q") ?? searchParams.get("open") ?? ""; // Keep the URL shareable as the user asks (the component reports each // question via onAsk). const onAsk = useCallback( (q: string) => { const next = new URLSearchParams(searchParams.toString()); if (q) next.set("q", q); else next.delete("q"); next.delete("open"); if (next.toString() !== searchParams.toString()) { router.replace(`/w/${workspaceSlug}/ask${next.toString() ? `?${next.toString()}` : ""}`, { scroll: false }); } }, [searchParams, router, workspaceSlug] ); return ( ); }